package com.sohoometer.test;

import static org.junit.Assert.*;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.nari.heatshare.dao.IAssignMeterDataGatherDao;
import com.nari.heatshare.service.IAssignMeterDataGatherService;
import com.nari.platform.model.PageCond;
import com.nari.platform.model.ResultWithPageCond;
import com.sohoometer.web.bean.AssignDataWithInfo;

public class testAssignMeter {
	@Test
	public void testCollection() throws Exception {
		 ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:applicationContext-*.xml");
		 IAssignMeterDataGatherService service =  (IAssignMeterDataGatherService) context.getBean("IAssignMeterDataGatherService");
		 String centerNo = "201400002462";//131105001039
		 String date = "2015-08-21";//2015-04-03
		 String pattern = "yyyy-MM-dd";
		 DateFormat dateFormat = new SimpleDateFormat(pattern);
		 Date parse = dateFormat.parse(date);
//		 service.getUnUploadRegisteData(centerNo, parse);
		 System.out.println(service);
	}
	@Test
	public void testAssignMeterData() throws Exception {
		ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:applicationContext-*.xml");
	IAssignMeterDataGatherDao  data=	(IAssignMeterDataGatherDao) context.getBean("IAssignMeterDataGatherDao");
	String buildingUID ="40288127494ad83901495f98749102c9";
	String date ="2015-01-29 02:01:21";
	DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	Date recordTime = dateFormat.parse(date);
	PageCond pageCond =new PageCond();
	ResultWithPageCond<AssignDataWithInfo> queryAssignDataWithInfo = data.queryAssignDataWithInfo(buildingUID, recordTime, pageCond);
	System.out.println(queryAssignDataWithInfo);
	}
	@Test
	public void testPageCond() throws Exception {
		PageCond pageCond = new PageCond();
		System.out.println(pageCond.getLimit());
	}
	@Test
	public void testFloat() throws Exception {
		double a =123.12312312312312423432;
		System.out.println(String.format("%.3f", a));
		
	}
}
